import Mock from 'mockjs'
import { builder } from '@/mock/util.js'

const name = ["撤回商标注册申请","商标无效宣告","商标注册【公司】","商标异议复审","商标申请（个体）"]
const status = ["待提交","已提交","材料反馈","顾问确认","待提官方","已提官方"]
const num = parseInt(Math.random() * (4 + 1), 10)

const businessList = () => {
	let data = []
	
	for(let i = 0; i < 30; i++) {
		
		data.push({
			cb_id: Mock.mock('@id()'),
			business_name: name[num],
			status2: status[num],
			updated_at: Mock.mock("@datetime")
		})
	}
	return builder(data, '', 1)
}

const businessDetail = () => {
	return builder({
		cb_id: Mock.mock('@id()'),
		business_name: name[num],
		status2: status[num],
		updated_at: Mock.mock("@datetime"),
		customer_name: Mock.mock("@cname"),
		sb_info: Mock.mock("@string"),
		phone: '15050835601',
		phone2: '15050835601',
	}, '', 1)
}

Mock.mock('http://localhost/api/list', 'get', businessList)
Mock.mock('http://localhost/api/detail', 'get', businessDetail)